
package ui.adapter;

import android.content.Context;
import android.content.Intent;

import net.ck.hzq.R;

import java.util.ArrayList;
import java.util.List;

import Bean.AchievementBean;
import base.BaseViewHolder;
import base.SuperBaseAdapter;
import coom.Constants;
import ui.activity.profit.ProfitDetailsAct;


/**
 * 收益适配器
 * Created by chenjian on 19/2/27.
 */
public class AchievementAdapter extends SuperBaseAdapter<AchievementBean.DataBean.ItemsBean> {

    List<AchievementBean.DataBean.ItemsBean> mData = new ArrayList<>();
    Context mContext;

    public AchievementAdapter(Context context, List<AchievementBean.DataBean.ItemsBean> data) {
        super(context, data);
        mContext = context;
        mData = data;
    }

    @Override
    protected void convert(BaseViewHolder holder, final AchievementBean.DataBean.ItemsBean item, final int position) {
        holder.setText(R.id.item_month, item.getTime() + "月业绩").setText(R.id.item_newbusinesses, item.getMerchant() + "")
                .setText(R.id.item_newallies, item.getAlly() + "").setText(R.id.item_totaltransaction, item.getAllmoney() + "")
                .setText(R.id.item_myincome, item.getMymoney() + "").setText(R.id.item_txt1, "MPOS: " + item.getZyMpos())
                .setText(R.id.item_txt2, "传统POS: " + item.getZyPos()).setText(R.id.item_txt3, "MPOS: " + item.getAllyMpos())
                .setText(R.id.item_txt4, "传统POS: " + item.getAllyPos()).setText(R.id.item_txt5, "直营交易: " + item.getZymoney())
                .setText(R.id.item_txt6, "合伙人交易: " + item.getAllymoney());
        holder.getView(R.id.perform_details).setOnClickListener(v -> {
            Intent intent = new Intent(mContext, ProfitDetailsAct.class);
            intent.putExtra(Constants.KEYSTRING, item.getTime());
            mContext.startActivity(intent);
        });

    }


    @Override
    protected int getItemViewLayoutId(int position, AchievementBean.DataBean.ItemsBean item) {
        return R.layout.item_listview;
    }

}
